<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head th:insert="fragments/head">
</head>
<body>
<header th:insert="fragments/header"></header>

<main>
    <div class="container">
        <h3 class="center">Iniciar Sesión</h3>
        <br>
        <div class="row">
            <div class="section col s12 m6 l4 offset-m3 offset-l4">
                <form method="post"
                      th:action="@{/login}"
                >
                    <div th:if="${param.error}">
                        <h5 class="center red-text text-lighten-1">Usuario o contraseña inválida</h5>
                    </div>
                    <br>
                    <div class="input-field">
                        <label for="username">Usuario</label>
                        <input type="text" class="class-controller"
                               id="username" name="username" autofocus
                        >
                    </div>

                    <div class="input-field mb-5">
                        <label for="password">Contraseña</label>
                        <input type="password" class="class-controller"
                               id="password" name="password"
                        >
                    </div>

                    <div class="center">
                        <button type="submit" class="btn">
                            Ingresar
                        </button>
                    </div>
                    <div class="mt-5">
                        <span>No estas registrado todavía? </span><a th:href="@{/register}" class="teal-text">Regístrate aquí</a>
                    </div>
                </form>
            </div>
        </div>
    </div>
</main>
<br><br>
<footer class="page-footer teal" th:insert="fragments/footer">

</footer>

<!--  Scripts-->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="/js/materialize.js"></script>
<script src="/js/init.js"></script>
</body>
</html>